//
//  RecommendCell.m
//  TopTabControl
//
//  Created by wqh on 15-5-8.
//  Copyright (c) 2015年 Wqh. All rights reserved.
//

#import "RecommendCell.h"
#import "UIImageView+WebCache.h"
@implementation RecommendCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)showDataWithModel:(RecommendModel *)model type:(BOOL)isNewest {
   
    NSString *imgPath = @"";
    if (model.smallimg) {
        imgPath = model.smallimg;
    }else if(model.smallpic) {
        imgPath = model.smallpic;
    }
    [self.img sd_setImageWithURL:[NSURL URLWithString:imgPath] placeholderImage:[UIImage imageNamed:@"default_80_60"]];
    
    if ([model.mediatype.stringValue isEqualToString:@"5"]) {
        self.replycountLabel.text = [NSString stringWithFormat:@"%@回帖",model.replycount.stringValue];
    }else {
        self.replycountLabel.text = [NSString stringWithFormat:@"%@评论",model.replycount.stringValue];
    }
    
    self.titleLabel.text = model.title;
    
    self.timeLabel.text = model.time;
    
    
    
    if ([model.replycount.stringValue isEqualToString:@"0"]) {
        self.replycountLabel.hidden = YES;
    }
    self.typeLabel.hidden = YES;
    if (isNewest) {
        
        if ([model.mediatype.stringValue isEqualToString:@"2"]) {
            self.typeLabel.hidden = NO;
            self.typeLabel.text = @"说客";
        }
        
    }
    
 
}
@end
